package com.zhulin.android.edoctor;

import com.zhulin.android.edoctor.jsonobject.INUserLogin;
import com.zhulin.android.edoctor.parsehandler.UserLoginParseHandler;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class EDApplication extends Application{

	public int screenWidthdpi=0;
	public int screenHeightdpi=0;
	
	SharedPreferences sp;
	
	@Override
	public void onCreate() {
		super.onCreate();
		sp=PreferenceManager.getDefaultSharedPreferences(this);
	}
	
	public INUserLogin getUserInfo(){
		INUserLogin inUserLogin=new INUserLogin();
		inUserLogin.setLoginName(sp.getString("userName", ""));
		inUserLogin.setPassword(sp.getString("password", ""));
		return inUserLogin;
	}
	
	public void setUserInfo(INUserLogin inUserLogin){
		Editor editor= sp.edit();
		editor.putString("loginName", inUserLogin.getLoginName());
		editor.putString("password", inUserLogin.getPassword());
		
		editor.commit();
	}
	
	@Override
	public void onLowMemory() {
		super.onLowMemory();
	}
	
	public int getScreendpi() {
		return screenWidthdpi;
	}

	public void setScreendpi(int screendpi) {
		this.screenWidthdpi = screendpi;
	}

	public int getScreenHeightdpi() {
		return screenHeightdpi;
	}

	public void setScreenHeightdpi(int screenHeightdpi) {
		this.screenHeightdpi = screenHeightdpi;
	}

}
